//
//  RowInputBaseM.m
//  
//  jhf
//
//  Created by 计海峰 on 2020/3/24.
//  Copyright © 2020 计海峰. All rights reserved.
//

#import "RowInputBaseM.h"
#import <CooperSDK/NSString+Safe.h>

#define COOPERNUM @"0123456789"
#define COOPERALPHA @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
#define COOPERALPHANUM @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"

@interface RowInputBaseM ()

// 0 默认输入 1 验证码  2 密码
@property (nonatomic, assign) NSInteger config_type;

@end

@implementation RowInputBaseM

// 默认
+ (RowInputBaseM *)defaultConfigTitle:(NSString *)titleStr value:(NSString *)valueStr {
    RowInputBaseM *config = [[RowInputBaseM alloc] init];
    config.titleLBControl = [LabelControlM defaultText:titleStr];
    config.config_type = 0;
    config.inputControl = [InputControlM defaultInputText:valueStr];
    NSString *placeholderStr = [NSString stringWithFormat:@"请输入%@", titleStr];
    if ([placeholderStr hasSuffix:@":"] || [placeholderStr hasSuffix:@"："]) {
        placeholderStr = placeholderStr.safeRetainRemoveLast;
    }
    config.inputControl.placeholderStr = placeholderStr;
    config.optionData = false;
    return config;
}

// code
+ (RowInputBaseM *)defalutCodeConfigTitle:(NSString *)titleStr value:(NSString *)valueStr {
    RowInputBaseM *config = [RowInputBaseM defaultConfigTitle:titleStr value:valueStr];
    config.config_type = 1;
    config.inputControl.maxLength = 6;
    return config;
}

// password
+ (RowInputBaseM *)defalutPasswordConfigTitle:(NSString *)titleStr value:(NSString *)valueStr {
    RowInputBaseM *config = [RowInputBaseM defaultConfigTitle:titleStr value:valueStr];
    config.config_type = 2;
    config.inputControl.secureTextEntry = true;
    return config;
}

@end
